import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '管控措施描述',
    align: "center",
    dataIndex: 'riskMeasureDesc'
  },
  {
    title: '隐患排查内容',
    align: "center",
    dataIndex: 'troubleshootOntent'
  },
  {
    title: '排查周期',
    align: "center",
    dataIndex: 'period'
  },
  {
    title: '周期单位',
    align: "center",
    dataIndex: 'periodUnit_dictText'
  },
  {
    title: '剩余时间',
    align: "center",
    dataIndex: 'timeRemaining'
  },
  {
    title: '排查人',
    align: "center",
    dataIndex: 'identifyPeople_dictText'
  },
  {
    title: '排查时间',
    align: "center",
    dataIndex: 'checkTime'
  },
  {
    title: '任务开始时间',
    align: "center",
    dataIndex: 'taskStartTime'
  },
  {
    title: '排查结果',
    align: "center",
    dataIndex: 'checkStatus_dictText'
  },
  {
    title: '创建人手机号',
    align: "center",
    dataIndex: 'createByMobile'
  },
  {
    title: '是否包保责任人任务标识',
    align: "center",
    dataIndex: 'isDefend_dictText'
  },
  {
    title: '手机识别码 IMEI',
    align: "center",
    dataIndex: 'mobileMe'
  },
  {
    title: '风险分析装置',
    align: "center",
    dataIndex: 'riskDeviceId_dictText'
  },
  {
    title: '风险分析单元',
    align: "center",
    dataIndex: 'riskUnitId_dictText'
  },
  // {
  //   title: '删除标志',
  //   align: "center",
  //   dataIndex: 'deleted_dictText'
  // },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "管控措施描述",
    field: 'riskMeasureDesc',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "隐患排查内容",
    field: 'troubleshootOntent',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "排查周期",
    field: 'period',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "周期单位",
    field: 'periodUnit',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "period_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "排查人",
    field: 'identifyPeople',
    component: 'JSelectUser',
    //colProps: {span: 6},
  },
  {
    label: "排查时间",
    field: "checkTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: "任务开始时间",
    field: "taskStartTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: "是否包保责任人任务标识",
    field: 'isDefend',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
    //colProps: {span: 6},
  },
  {
    label: "风险分析装置",
    field: 'riskDeviceId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_risk_device,name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "风险分析单元",
    field: 'riskUnitId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_risk_unit,risk_unit_name,id"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '管控措施描述',
    field: 'riskMeasureDesc',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入管控措施描述!'},
             ];
    },
  },
  {
    label: '隐患排查内容',
    field: 'troubleshootOntent',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入隐患排查内容!'},
             ];
    },
  },
  {
    label: '排查周期',
    field: 'period',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入排查周期!'},
             ];
    },
  },
  {
    label: '周期单位',
    field: 'periodUnit',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "period_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入周期单位!'},
             ];
    },
  },
  {
    label: '剩余时间',
    field: 'timeRemaining',
    component: 'Input',
  },
  {
    label: '排查人',
    field: 'identifyPeople',
    component: 'JSelectUser',
    componentProps:{
      labelKey: 'realname',
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入排查人!'},
             ];
    },
  },
  {
    label: '排查时间',
    field: 'checkTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '任务开始时间',
    field: 'taskStartTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入任务开始时间!'},
             ];
    },
  },
  {
    label: '排查结果',
    field: 'checkStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "check_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入排查结果!'},
             ];
    },
  },
  {
    label: '创建人手机号',
    field: 'createByMobile',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入创建人手机号!'},
             ];
    },
  },
  {
    label: '是否包保责任人任务标识',
    field: 'isDefend',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否包保责任人任务标识!'},
             ];
    },
  },
  {
    label: '手机识别码 IMEI',
    field: 'mobileMe',
    component: 'Input',
  },
  {
    label: '风险分析装置',
    field: 'riskDeviceId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_risk_device,name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入风险分析装置!'},
             ];
    },
  },
  {
    label: '风险分析单元',
    field: 'riskUnitId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_risk_unit,risk_unit_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入风险分析单元!'},
             ];
    },
  },
  {
    label: '删除标志',
    field: 'deleted',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  riskMeasureDesc: {title: '管控措施描述',order: 0,view: 'textarea', type: 'string',},
  troubleshootOntent: {title: '隐患排查内容',order: 1,view: 'textarea', type: 'string',},
  period: {title: '排查周期',order: 2,view: 'number', type: 'number',},
  periodUnit: {title: '周期单位',order: 3,view: 'list', type: 'string',dictCode: 'period_type',},
  timeRemaining: {title: '剩余时间',order: 4,view: 'text', type: 'string',},
  identifyPeople: {title: '排查人',order: 5,view: 'sel_user', type: 'string',},
  checkTime: {title: '排查时间',order: 6,view: 'datetime', type: 'string',},
  taskStartTime: {title: '任务开始时间',order: 7,view: 'datetime', type: 'string',},
  checkStatus: {title: '排查结果',order: 8,view: 'list', type: 'string',dictCode: 'check_status',},
  createByMobile: {title: '创建人手机号',order: 9,view: 'text', type: 'string',},
  isDefend: {title: '是否包保责任人任务标识',order: 10,view: 'radio', type: 'string',},
  mobileMe: {title: '手机识别码 IMEI',order: 11,view: 'text', type: 'string',},
  riskDeviceId: {title: '风险分析装置',order: 12,view: 'list', type: 'string',dictTable: "tb_base_risk_device", dictCode: 'id', dictText: 'name',},
  riskUnitId: {title: '风险分析单元',order: 13,view: 'list', type: 'string',dictTable: "tb_base_risk_unit", dictCode: 'id', dictText: 'risk_unit_name',},
  deleted: {title: '删除标志',order: 14,view: 'radio', type: 'string',dictCode: 'yn',},
};
